package sd.rmi.auction.server;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;

import sd.rmi.auction.interfaces.IAuction;

/**
 * 
 * @author v
 *
 */
public class ServerProxy {
	private IAuction service = null;
	private String serviceName = null;
	
	public ServerProxy(IAuction service, String serviceName) {
		this.service = service;
		this.serviceName = serviceName;
	}
	
	public void run() {
		 try {
			 
	        	LocateRegistry.createRegistry(1099);
	            Naming.rebind(serviceName, service);
	            
	     } catch (RemoteException ex) {
	    	 ex.printStackTrace();
	     }
	     catch(MalformedURLException ex1)
	     {
	         ex1.printStackTrace();
	     }
	}
}
